﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace Models
{
    static public class CompareViewsModel
    {
        //lấy danh sách Views trong database
        static public DataTable GetAllViews(DataModel conn)
        {
            DataTable tb =new DataTable();
            string query = @"SELECT v.name,m.[definition],v.modify_date
                                FROM sys.sql_modules m,sys.views v
                                WHERE m.object_id = v.object_id
                                ORDER BY create_date,modify_date";
            try
            {
                tb = conn.QueryResults(query).Tables[0];
            }
            catch
            {
                return new DataTable();
            }
            return tb;
        }

    }
}
